home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / forms / frmwiz / dataspec.frm < prev    next >
Text File  |  1995-01-14  |  11KB  |  401 lines

  1. VERSION 2.00
  2. Begin Form DataSpec 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Form Wizard - Data Control Specifications"
  6.    ClientHeight    =   3075
  7.    ClientLeft      =   3225
  8.    ClientTop       =   1635
  9.    ClientWidth     =   6090
  10.    ControlBox      =   0   'False
  11.    Height          =   3480
  12.    HelpContextID   =   18
  13.    Icon            =   DATASPEC.FRX:0000
  14.    Left            =   3165
  15.    LinkTopic       =   "Form1"
  16.    MaxButton       =   0   'False
  17.    ScaleHeight     =   3075
  18.    ScaleWidth      =   6090
  19.    Top             =   1290
  20.    Width           =   6210
  21.    Begin SSCommand BtnHelp 
  22.       Caption         =   "&Help"
  23.       Font3D          =   2  'Raised w/heavy shading
  24.       Height          =   615
  25.       Left            =   4320
  26.       Picture         =   DATASPEC.FRX:0302
  27.       TabIndex        =   14
  28.       Top             =   1980
  29.       Width           =   915
  30.    End
  31.    Begin CommonDialog CMDialog1 
  32.       DialogTitle     =   "Select Database For Data Control"
  33.       Filter          =   "Access Databases|*.mdb"
  34.       Left            =   120
  35.       Top             =   2100
  36.    End
  37.    Begin ComboBox LstRecSrce 
  38.       BackColor       =   &H00C0C0C0&
  39.       Height          =   300
  40.       Left            =   1560
  41.       Sorted          =   -1  'True
  42.       Style           =   2  'Dropdown List
  43.       TabIndex        =   4
  44.       Tag             =   "Select or enter record source for the data control"
  45.       Top             =   1560
  46.       Width           =   4395
  47.    End
  48.    Begin SSCommand BtnFindDB 
  49.       AutoSize        =   2  'Adjust Button Size To Picture
  50.       Font3D          =   2  'Raised w/heavy shading
  51.       Height          =   600
  52.       Left            =   5340
  53.       Picture         =   DATASPEC.FRX:0604
  54.       TabIndex        =   3
  55.       Tag             =   "Press to find the database"
  56.       Top             =   840
  57.       Width           =   600
  58.    End
  59.    Begin TextBox TxtDBName 
  60.       BackColor       =   &H00C0C0C0&
  61.       Height          =   375
  62.       Left            =   1560
  63.       TabIndex        =   2
  64.       Tag             =   "Name of the database for the data control"
  65.       Text            =   "Database Name"
  66.       Top             =   1080
  67.       Width           =   3675
  68.    End
  69.    Begin TextBox TxtName 
  70.       BackColor       =   &H00C0C0C0&
  71.       Height          =   375
  72.       Left            =   1560
  73.       TabIndex        =   0
  74.       Tag             =   "Name for the data control"
  75.       Text            =   "DataName"
  76.       Top             =   120
  77.       Width           =   3675
  78.    End
  79.    Begin TextBox TxtCaption 
  80.       BackColor       =   &H00C0C0C0&
  81.       Height          =   375
  82.       Left            =   1560
  83.       TabIndex        =   1
  84.       Tag             =   "Caption for the data control"
  85.       Text            =   "Data Caption"
  86.       Top             =   600
  87.       Width           =   3675
  88.    End
  89.    Begin SSCommand BtnPrev 
  90.       AutoSize        =   2  'Adjust Button Size To Picture
  91.       Caption         =   "&Previous"
  92.       Font3D          =   2  'Raised w/heavy shading
  93.       Height          =   615
  94.       Left            =   720
  95.       Picture         =   DATASPEC.FRX:0906
  96.       TabIndex        =   5
  97.       Tag             =   "Return to previous step"
  98.       Top             =   1980
  99.       Width           =   915
  100.    End
  101.    Begin SSCommand BtnNext 
  102.       AutoSize        =   2  'Adjust Button Size To Picture
  103.       Caption         =   "&Next"
  104.       Font3D          =   2  'Raised w/heavy shading
  105.       Height          =   615
  106.       Left            =   1620
  107.       Picture         =   DATASPEC.FRX:0C08
  108.       TabIndex        =   6
  109.       Tag             =   "Proceed to the next step"
  110.       Top             =   1980
  111.       Width           =   915
  112.    End
  113.    Begin SSCommand BtnCancel 
  114.       AutoSize        =   2  'Adjust Button Size To Picture
  115.       Caption         =   "&Cancel"
  116.       Font3D          =   2  'Raised w/heavy shading
  117.       Height          =   615
  118.       Left            =   2520
  119.       Picture         =   DATASPEC.FRX:0F0A
  120.       TabIndex        =   7
  121.       Tag             =   "Cancel building the form"
  122.       Top             =   1980
  123.       Width           =   915
  124.    End
  125.    Begin SSCommand BtnFinish 
  126.       AutoSize        =   2  'Adjust Button Size To Picture
  127.       Caption         =   "&Finish"
  128.       Enabled         =   0   'False
  129.       Font3D          =   2  'Raised w/heavy shading
  130.       Height          =   615
  131.       Left            =   3420
  132.       Picture         =   DATASPEC.FRX:120C
  133.       TabIndex        =   8
  134.       Top             =   1980
  135.       Width           =   915
  136.    End
  137.    Begin SSPanel cMsg 
  138.       Align           =   2  'Align Bottom
  139.       Alignment       =   1  'Left Justify - MIDDLE
  140.       BevelInner      =   1  'Inset
  141.       BorderWidth     =   2
  142.       Height          =   375
  143.       Left            =   0
  144.       TabIndex        =   9
  145.       Top             =   2700
  146.       Width           =   6090
  147.    End
  148.    Begin Label Label1 
  149.       Alignment       =   1  'Right Justify
  150.       AutoSize        =   -1  'True
  151.       BackColor       =   &H00C0C0C0&
  152.       Caption         =   "Record Source"
  153.       ForeColor       =   &H00FF0000&
  154.       Height          =   195
  155.       Index           =   3
  156.       Left            =   195
  157.       TabIndex        =   13
  158.       Top             =   1620
  159.       Width           =   1290
  160.    End
  161.    Begin Label Label1 
  162.       Alignment       =   1  'Right Justify
  163.       AutoSize        =   -1  'True
  164.       BackColor       =   &H00C0C0C0&
  165.       Caption         =   "Database Name"
  166.       ForeColor       =   &H00FF0000&
  167.       Height          =   195
  168.       Index           =   2
  169.       Left            =   120
  170.       TabIndex        =   12
  171.       Top             =   1200
  172.       Width           =   1365
  173.    End
  174.    Begin Label Label1 
  175.       Alignment       =   1  'Right Justify
  176.       AutoSize        =   -1  'True
  177.       BackColor       =   &H00C0C0C0&
  178.       Caption         =   "Name"
  179.       ForeColor       =   &H00FF0000&
  180.       Height          =   195
  181.       Index           =   1
  182.       Left            =   960
  183.       TabIndex        =   11
  184.       Top             =   180
  185.       Width           =   495
  186.    End
  187.    Begin Label Label1 
  188.       Alignment       =   1  'Right Justify
  189.       AutoSize        =   -1  'True
  190.       BackColor       =   &H00C0C0C0&
  191.       Caption         =   "Caption"
  192.       ForeColor       =   &H00FF0000&
  193.       Height          =   195
  194.       Index           =   0
  195.       Left            =   780
  196.       TabIndex        =   10
  197.       Top             =   660
  198.       Width           =   660
  199.    End
  200. End
  201. Option Explicit
  202.  
  203. Sub BtnCancel_Click ()
  204.     EndItNow
  205.  
  206. End Sub
  207.  
  208. Sub BtnCancel_GotFocus ()
  209.     cMsg.Caption = BtnCancel.Tag
  210.  
  211. End Sub
  212.  
  213. Sub BtnCancel_LostFocus ()
  214.     cMsg.Caption = ""
  215.     
  216. End Sub
  217.  
  218. Sub BtnFindDB_Click ()
  219.     CMDialog1.Flags = OFN_FILEMUSTEXIST
  220.     CMDialog1.Action = 1
  221.     If CMDialog1.Filename <> "" Then
  222.         TxtDBName = CMDialog1.Filename
  223.         GetTableNames
  224.     End If
  225.  
  226. End Sub
  227.  
  228. Sub BtnFindDB_GotFocus ()
  229.     cMsg.Caption = BtnFindDB.Tag
  230.  
  231. End Sub
  232.  
  233. Sub BtnFindDB_LostFocus ()
  234.     cMsg.Caption = ""
  235.  
  236. End Sub
  237.  
  238. Sub BtnHelp_Click ()
  239.     SendKeys "{F1}"
  240.  
  241. End Sub
  242.  
  243. Sub BtnNext_Click ()
  244.     FieldFrm.Show MODELESS
  245.     DataSpec.Hide
  246.  
  247. End Sub
  248.  
  249. Sub BtnNext_GotFocus ()
  250.     cMsg.Caption = BtnNext.Tag
  251.  
  252. End Sub
  253.  
  254. Sub BtnNext_LostFocus ()
  255.     cMsg.Caption = ""
  256.  
  257. End Sub
  258.  
  259. Sub BtnPrev_Click ()
  260.     CaptnFrm.Show MODELESS
  261.     DataSpec.Hide
  262.  
  263. End Sub
  264.  
  265. Sub BtnPrev_GotFocus ()
  266.     cMsg.Caption = BtnPrev.Tag
  267.  
  268. End Sub
  269.  
  270. Sub BtnPrev_LostFocus ()
  271.     cMsg.Caption = ""
  272.  
  273. End Sub
  274.  
  275. Sub FldGotFocus (PControl As Control)
  276.     PControl.BackColor = BLUE
  277.     PControl.ForeColor = WHITE
  278.     PControl.SelStart = 0
  279.     PControl.SelLength = 1000
  280.     cMsg.Caption = PControl.Tag
  281.  
  282. End Sub
  283.  
  284. Sub FldLostFocus (PControl As Control)
  285.     PControl.BackColor = RB_GRAY
  286.     PControl.ForeColor = BLACK
  287.     cMsg.Caption = ""
  288.  
  289. End Sub
  290.  
  291. Sub Form_Paint ()
  292.     Form3d Me
  293.  
  294. End Sub
  295.  
  296. Sub GetTableNames ()
  297.     ' Get names of tables in selected database
  298.     Dim sstables As snapshot, msg As String
  299.  
  300.     On Error GoTo GetTablesErr
  301.     mousepointer = HOURGLASS
  302.     If TxtDBName.Text = "" Then Exit Sub
  303.     On Error GoTo OpenDBErr
  304.     If Dir$(TxtDBName.Text) = "" Then
  305.         Beep
  306.         MsgBox "The database name you have specified does not exist!  Use the file drawer button to locate a database.", 0 + 48 + 0 + 0, "Database Selection Error"
  307.         TxtDBName.SetFocus
  308.         mousepointer = DEFAULT
  309.         Exit Sub
  310.     End If
  311.     LstRecSrce.Clear
  312.     Set db = OpenDatabase(TxtDBName.Text)
  313.     On Error GoTo GetTablesErr
  314.     Set sstables = db.ListTables()
  315.     Do While Not sstables.EOF
  316.         If sstables!Attributes And DB_SYSTEMOBJECT Then
  317.         Else
  318.             LstRecSrce.AddItem sstables!Name
  319.         End If
  320.         sstables.MoveNext
  321.     Loop
  322.     sstables.Close
  323.     LstRecSrce.ListIndex = 0
  324.     mousepointer = DEFAULT
  325.  
  326.     Exit Sub
  327.  
  328. OpenDBErr:
  329.     Beep
  330.     mousepointer = DEFAULT
  331.     msg = "A " & Error & " error has occurred opening the database!  Please correct and retry the function"
  332.     MsgBox msg, 0 + 48 + 0 + 0, "Database Specification Error"
  333.     TxtDBName.SetFocus
  334.     On Error GoTo GetTablesErr
  335.     mousepointer = DEFAULT
  336.     Exit Sub
  337.  
  338.  
  339. GetTablesErr:
  340.     mousepointer = DEFAULT
  341.     erraction = RB_ErrorHandler("DataSpec", "GetTableNames")
  342.     Select Case erraction
  343.     Case 1
  344.         Resume 0      ' Retry option selected
  345.     Case 2
  346.         Resume Next   ' Ignore option selected
  347.     End Select
  348.     
  349. End Sub
  350.  
  351. Sub LstRecSrce_Click ()
  352.     NewRecordSource = True
  353.  
  354. End Sub
  355.  
  356. Sub LstRecSrce_GotFocus ()
  357.     LstRecSrce.BackColor = BLUE
  358.     LstRecSrce.ForeColor = WHITE
  359.     cMsg.Caption = LstRecSrce.Tag
  360.     
  361. End Sub
  362.  
  363. Sub LstRecSrce_LostFocus ()
  364.     FldLostFocus LstRecSrce
  365.  
  366. End Sub
  367.  
  368. Sub TxtCaption_GotFocus ()
  369.     FldGotFocus TxtCaption
  370.  
  371. End Sub
  372.  
  373. Sub TxtCaption_LostFocus ()
  374.     FldLostFocus TxtCaption
  375.  
  376. End Sub
  377.  
  378. Sub TxtDBName_GotFocus ()
  379.     FldGotFocus TxtDBName
  380.  
  381. End Sub
  382.  
  383. Sub TxtDBName_LostFocus ()
  384.     FldLostFocus TxtDBName
  385.     If TxtDBName.DataChanged Then
  386.         GetTableNames
  387.     End If
  388.  
  389. End Sub
  390.  
  391. Sub TxtName_GotFocus ()
  392.     FldGotFocus TxtName
  393.     
  394. End Sub
  395.  
  396. Sub TxtName_LostFocus ()
  397.     FldLostFocus TxtName
  398.  
  399. End Sub
  400.  
  401.